<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>上传</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
    <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
    <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
</head>
<body>
<table class="nobordertable noborder" style="border: none;">
    <tbody>
    <tr>
        <td class="al_r" width="50%" valign="top">
            <label>上传MC清单:</label>
        </td>
        <td width="50%">
            <input type="file" value="上传MC清单" id="fileUpload" />
        </td>
    </tr>
    <tr>
        <td class="al_r" width="30%" valign="top">

        </td>
        <td width="70%" id="fileName">
            <%--<span class="color-blue">12312312.jpg</span>&nbsp;&nbsp;
            <span style="cursor: pointer;">[删除]</span>--%>
        </td>
    </tr>
    </tbody>
</table>
</body>
</html>
<script type="text/javascript">
    $(function(){
        var cbsServiceId = $("#cbsServiceId").val();
        $("#fileUpload").uploadify({
            buttonText : '上传MC清单',
            auto : true,
            progressData : 'percentage',
            multi : true,
            height : 20,
            width : 80,
            overrideEvents : ['onDialogClose'],
            queueID : 'instructionfile',
            fileTypeDesc : '文件格式:*',
            fileTypeExts : '*.*',
            /* fileTypeDesc : '支持格式:*.pdf',
             fileTypeExts : '*.pdf',*/ //控制可上传文件的扩展名，启用本项时需同时声明fileDesc
            fileSizeLimit : '50MB',
            swf : 'plug-in/uploadify/uploadify.swf',
            uploader : 'cbsContractController.do?importExcel',
            onUploadStart:function (){
                lockmask(true,'请稍等,导入中...');
            },
            onUploadSuccess : function(file,data) {
                lockmask(false);
                if(data==null||""==data){
                    top.window.tip("文件导入成功！");
                }else{
                    var json = $.parseJSON(data).attributes;
                    console.log(json.name)
                    $("#fileName").html("");
                    var html = '<p><span class="color-blue">'+json.name+'</span>&nbsp;&nbsp; ' +
                        '<span style="cursor: pointer;"'
                    $("#fileName").prepend(html);
                    //$("#instruction").fadeIn();
                    //tip(json.msg);
                    top.window.tip(json.msg);
                }
                addOneTab("合同管理", "cbsContractController.do?cbsContract");
                frameElement.api.close();
            },onFallback : function(){
                tip("您未安装FLASH控件，无法上传文件！请安装FLASH控件后再试");
            },onSelectError : function(file, errorCode, errorMsg){
                switch(errorCode) {
                    case -100:
                        tip("上传的文件数量已经超出系统限制的"+$('#instruction').uploadify('settings','queueSizeLimit')+"个文件！");
                        break;
                    case -110:
                        tip("文件 [" + file.name + "] 大小超出系统限制的50MB大小！");break;
                    case -120:
                        tip("文件 ["+file.name+"] 大小异常！");
                        break;
                    case -130:
                        tip("文件 ["+file.name+"] 类型不正确！");
                        break;
                };
            }
        });
    });
</script>
